//
//  PromptBox.m
//  wajinAPP
//
//  Created by 哇金mac on 2017/7/28.
//  Copyright © 2017年 哇金mac. All rights reserved.
//

#import "PromptBox.h"

@implementation PromptBox

+ (id)HUDShareInstance
{
    static MBProgressHUD *hud;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        UIWindow *window = [UIApplication sharedApplication].keyWindow;
        hud = [[MBProgressHUD alloc]initWithView:window];
        [window addSubview:hud];
    });
    return hud;
}

+ (void)showPromptBoxText:(NSString*)text
{
    if ([text isKindOfClass:[NSString class]]){
        MBProgressHUD *hud = [PromptBox HUDShareInstance];
        hud.mode = MBProgressHUDModeText;
        hud.label.text = text;
        hud.label.textColor = [UIColor whiteColor];
        hud.label.font = [UIFont systemFontOfSize:16];
        hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
        hud.bezelView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];;
        [hud showAnimated:YES];
        [hud hideAnimated:YES afterDelay:2.0];
    }
}
@end


